package com.common.viewlibrary.base;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.common.viewlibrary.R;
import com.common.viewlibrary.utils.ToastUtils;

/**
 * Created by hanyuejian
 * on 2018/7/20.
 */
public class BaseWithBackActivity extends BaseActivity {

    ImageView back;
    TextView title;
    FrameLayout contentView;
    TextView right;
    View status;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);
        setContentView(R.layout.base_with_back);

        right=findViewById(R.id.rightText);
        back = findViewById(R.id.backIcon);
        title = findViewById(R.id.title);
        contentView = findViewById(R.id.content);
        status=findViewById(R.id.statusBar);
        setBarColor(status);
        back.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                finish();
            }
        });


    }

    protected void setTitle(String name) {
        title.setText(name);
    }

    protected TextView  setRightText(String text){
        right.setText(text);
        return right;
    }

    protected void setLayout(int layoutId) {
        LayoutInflater.from(this).inflate(layoutId, contentView);
    }


}
